﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Easydp.Models;
using Easydp.Models.Entities;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Data;
namespace Easydp.Controllers
{
    [DataObject()]
    public class TravlerController
    {
        TravlerManager travlermanager = new TravlerManager();

        /// <summary>
        /// 返回TT_Travler表
        /// </summary>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public TT_Travler GetAllTravler()
        {
            return travlermanager.GetAllTravler();
        }



        [DataObjectMethod(DataObjectMethodType.Select)]
        /// <summary>
        /// 得到模型
        /// </summary>
        public TT_Travler GetModel(int UserID)
        {
            return travlermanager.GetModel(UserID);
        }



        /// <summary>
        /// 得到列表
        /// </summary>
        /// 
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<TT_Travler> GetListTravler(int UserID)
        {
            return travlermanager.GetListTravler(UserID);
        }

        /// <summary>
        /// update
        /// </summary>
        /// 
        [DataObjectMethod(DataObjectMethodType.Update)]
        public void Update(TT_Travler model)
        {
            try
            {
                int i = travlermanager.Update(model);
                if (i <= 0)
                    throw new Exception("更新失败");
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

        }

        /// <summary>
        /// 获得数据列表Dataset
        /// </summary>
        public DataSet GetDataset(string Where)
        {
            return travlermanager.GetList(Where);
        }
    }
}
